function throttle (fn, wait) {
  let timer;
  return function () {
    if (!timer) {
      const context = this;
      const args = arguments;
      fn.apply(context, args);

      timer = setTimeout(function() {
        clearTimeout(timer);
      }, wait)
    }
  }
}

function test () {
  console.log('ssss');
}

const throttleTest = throttle(test, 1000);
throttleTest()
throttleTest()
throttleTest()
